package com.erebus.utils;


import cn.hutool.core.date.ChineseDate;
import cn.hutool.core.date.DateUtil;
import com.nlf.calendar.Lunar;
import com.nlf.calendar.LunarYear;
import com.nlf.calendar.Solar;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.List;

// 六十甲子
public class Pregnancy {

    // 天干
    private static final String[] GAN = {"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"};
    // 地支
    private static final String[] ZHI = {"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"};
    // 六十甲子 六旬
    private static final String[][] JIAZI = {{"甲子", "乙丑", "丙寅", "丁卯", "戊辰", "己巳", "庚午", "辛未", "壬申", "癸酉"},
            {"甲戌", "乙亥", "丙子", "丁丑", "戊寅", "己卯", "庚辰", "辛巳", "壬午", "癸未"},
            {"甲申", "乙酉", "丙戌", "丁亥", "戊子", "己丑", "庚寅", "辛卯", "壬辰", "癸巳"},
            {"甲午", "乙未", "丙申", "丁酉", "戊戌", "己亥", "庚子", "辛丑", "壬寅", "癸卯"},
            {"甲辰", "乙巳", "丙午", "丁未", "戊申", "己酉", "庚戌", "辛亥", "壬子", "癸丑"},
            {"甲寅", "乙卯", "丙辰", "丁巳", "戊午", "己未", "庚申", "辛酉", "壬戌", "癸亥"}};

    // 六十甲子
    public String[] JiaZi = new String[60];

    public Pregnancy() {
        int a = 0, b = 0;
        for (int i = 0; i < 60; i++) {
            if (a == 10) {
                a = 0;
            }
            if (b == 12) {
                b = 0;
            }
            JiaZi[i] = GAN[a++] + ZHI[b++];
        }
    }

    /**
     * 日上起时
     * 甲己还加甲
     * 乙庚丙作初
     * 丙辛生戊子
     * 丁壬庚子居
     * 戊癸何方发
     * 壬子不须移
     */
    // 阳历转阴历
    public static String getEightCharacters(int year, int month, int day, int hour, int minute) {
        String[] yinli = new String[4];

        //通过公历构建
        ChineseDate chineseDate = new ChineseDate(DateUtil.parseDate(year + "-" + month + "-" + day));
        // 庚子年甲申月癸卯日
        String cyclicalYMD = chineseDate.getCyclicalYMD();

        yinli[0] = cyclicalYMD.substring(0, 3);
        yinli[1] = cyclicalYMD.substring(3, 6);
        yinli[2] = cyclicalYMD.substring(6, 9);
        // 根据日干，排列时辰
        String[] shichen = new String[12];
        // 0->子时，1->丑时，2->丑时，3->寅时，4->寅时，5->卯时，6->卯时，7->辰时，8->辰时，9->巳时，10->巳时，11->午时
        // 12->午时，13->未时，14->未时，15->申时，16->申时，17->酉时，18->酉时，19->戌时，20->戌时，21->亥时，22->亥时，23->子时
        int[] index = {0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 0};
        switch (yinli[2].substring(0, 1)) {
            case "甲", "己":
                for (int i = 0, j = 0; i < 12; i++, j++) {
                    if (j == 10) { // 天干索引
                        j = 0;
                    }
                    shichen[i] = GAN[j] + ZHI[i];
                }
                break;
            case "乙", "庚":
                for (int i = 0, j = 2; i < 12; i++, j++) {
                    if (j == 10) {
                        j = 0;
                    }
                    shichen[i] = GAN[j] + ZHI[i];
                }
                break;
            case "丙", "辛":
                for (int i = 0, j = 4; i < 12; i++, j++) {
                    if (j == 10) {
                        j = 0;
                    }
                    shichen[i] = GAN[j] + ZHI[i];
                }
                break;
            case "丁", "壬":
                for (int i = 0, j = 6; i < 12; i++, j++) {
                    if (j == 10) {
                        j = 0;
                    }
                    shichen[i] = GAN[j] + ZHI[i];
                }
                break;
            case "戊", "癸":
                for (int i = 0, j = 8; i < 12; i++, j++) {
                    if (j == 10) {
                        j = 0;
                    }
                    shichen[i] = GAN[j] + ZHI[i];
                }
                break;
            default:
        }

        yinli[3] = shichen[index[hour]] + "时";


        return yinli[0] + yinli[1] + yinli[2] + yinli[3];
    }


    /**
     * 计算生日的前后两个节气
     */
    public static Solar[] getSolarTerm(int year, int month, int day, int hour, int minute) {

        // 定义格式
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        // 转换为 时间戳
        long timestamp = DateUtil.parseDate(year + "-" + month + "-" + day + " " + hour + ":" + minute).getTime();
        Solar s1, s2;
        Lunar l1, l2;
        Solar[] solarList = new Solar[2];

        LunarYear lunarYear = LunarYear.fromYear(year);
        List<Double> jieQiJulianDays = lunarYear.getJieQiJulianDays();

        for (int i = 0; i < jieQiJulianDays.size(); i += 2) {
            Solar solar = Solar.fromJulianDay(jieQiJulianDays.get(i));
            Lunar lunar = solar.getLunar();
            String ymdHms = solar.toYmdHms(); //2024-12-06 23:16:47
            // 解析为 LocalDateTime
            LocalDateTime dateTime2 = LocalDateTime.parse(ymdHms, formatter);
            // 转换为时间戳（毫秒）
            long t2 = dateTime2.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();

            if (timestamp <= t2) { // 生日后一个节气
                s2 = solar;
                l2 = lunar;
                Solar solars = Solar.fromJulianDay(jieQiJulianDays.get(i - 2));
                Lunar lunars = solars.getLunar();
                String ymdHmss = solars.toYmdHms(); //2024-12-06 23:16:47
                LocalDateTime dateTime1 = LocalDateTime.parse(ymdHmss, formatter);
                // 转换为时间戳（毫秒）
                long t1 = dateTime1.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
                if (timestamp >= t1) { // 生日前一个节气
                    s1 = solars;
                    l1 = lunars;
                    System.out.println(s1.toYmdHms() + " " + l1.getJieQi());
                    System.out.println(s2.toYmdHms() + " " + l2.getJieQi());
                    solarList[0] = s1;
                    solarList[1] = s2;
                    return solarList;
                } else {
                    break;
                }
            }
        }
        return null;
    }

    /**
     * 起运时间,
     */
    public static int qiyun(int year, int month, int day, int hour, int minute, Solar[] solars, String sex) {
        Solar[] solarTerm = Pregnancy.getSolarTerm(year, month, day, hour, minute);
        System.out.println(solarTerm[0].toYmdHms() + " " + solarTerm[0].getLunar().getJieQi());
        System.out.println(solarTerm[1].toYmdHms() + " " + solarTerm[1].getLunar().getJieQi());

        int year1, year2, month1, month2, day1, day2, hour1, hour2, minute1, minute2;
        year1 = solarTerm[0].getYear();
        month1 = solarTerm[0].getMonth();
        day1 = solarTerm[0].getDay();
        hour1 = solarTerm[0].getHour();
        minute1 = solarTerm[0].getMinute();
        year2 = solarTerm[1].getYear();
        month2 = solarTerm[1].getMonth();
        day2 = solarTerm[1].getDay();
        hour2 = solarTerm[1].getHour();
        minute2 = solarTerm[1].getMinute();
        System.out.println(year1 + " " + month1 + " " + day1 + " " + hour1 + " " + minute1);
        System.out.println(year2 + " " + month2 + " " + day2 + " " + hour2 + " " + minute2);

        String eightCharacters = Pregnancy.getEightCharacters(year, month, day, hour, minute);
        String niangan = eightCharacters.substring(0, 1);  // 年干
        String yuegan = eightCharacters.substring(3, 4);  // 月干
        String yuezhi = eightCharacters.substring(4, 5);  // 月干
        boolean yinyang = true; // 天干阴阳，阳true 阴false
        String[] GAN = {"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"};
        String[] ZHI = {"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"};
        if (niangan.equals("甲") || niangan.equals("丙") || niangan.equals("戊") || niangan.equals("庚") || niangan.equals("壬")) {
            yinyang = true; // 阳年干
        } else {
            yinyang = false;
        }

        // 1、男命还是女命
        if ((sex.equals("男") && yinyang) || (sex.equals("女") && !yinyang)) { // 阳男阴女顺排
            int[] obscuritys = obscurity1(year2, month2, day2, hour2, minute2,
                    year, month, day, hour, minute); // 返回一个数组，日、时、分
            int num = obscuritys[0] * 24 * 60 + obscuritys[1] * 60 + obscuritys[2];  // 化分
            // 三天=一年，一天=四个月， 一小时=五天， 一分钟=两小时
            // 每分钟要放大120倍
            num = num * 120;

            return num;

        } else {// 逆排
            int[] obscuritys = obscurity1(year1, month1, day1, hour1, minute1,
                    year, month, day, hour, minute); // 返回一个数组，日、时、分
            int num = obscuritys[0] * 24 * 60 + obscuritys[1] * 60 + obscuritys[2];  // 化分
            // 三天=一年，一天=四个月， 一小时=五天， 一分钟=两小时
            // 每分钟要放大120倍
            num = num * 120;

            return num;
        }

    }

    /**
     * 分钟转化日期
     */
    public static int[] convertMinutesToTime(int totalMinutes) {
        final int MINUTES_IN_YEAR = 525600; // 365 * 24 * 60
        final int MINUTES_IN_MONTH = 43800; // 30 * 24 * 60
        final int MINUTES_IN_DAY = 1440;    // 24 * 60
        final int MINUTES_IN_HOUR = 60;

        int years = totalMinutes / MINUTES_IN_YEAR;
        totalMinutes %= MINUTES_IN_YEAR;

        int months = totalMinutes / MINUTES_IN_MONTH;
        totalMinutes %= MINUTES_IN_MONTH;

        int days = totalMinutes / MINUTES_IN_DAY;
        totalMinutes %= MINUTES_IN_DAY;

        int hours = totalMinutes / MINUTES_IN_HOUR;
        int minutes = totalMinutes % MINUTES_IN_HOUR;

        int[] list = {years, months, days, hours, minutes}; // 相差: %d天 %d小时 %d分钟
        System.out.printf("%d年%d个月%d天%d小时%d分钟%n",
                years, months, days, hours, minutes);
        return list;
    }

    /**
     * 生日到节气的差值
     */
    private static int[] obscurity1(int year1, int month1, int day1, int hour1, int minute1, int year2, int month2, int day2, int hour2, int minute2) {
        // 创建两个 LocalDateTime 对象
        LocalDateTime start = LocalDateTime.of(year1, month1, day1, hour1, minute1);
        LocalDateTime end = LocalDateTime.of(year2, month2, day2, hour2, minute2);
        if (start.isAfter(end)) {
            // 如果开始时间在结束时间之后，交换顺序并提示负数
            LocalDateTime temp = start;
            start = end;
            end = temp;
        }
        // 使用 Period 计算年、月、日差异
        Period period = Period.between(start.toLocalDate(), end.toLocalDate());

        int years = period.getYears();
        int months = period.getMonths();
        int days = period.getDays();

        // 使用 Duration 计算小时和分钟差异（跨天部分已经由 Period 处理）
        int totalMinutes = (int) Duration.between(start, end).toMinutes();
        int hours = totalMinutes / 60 % 24; // 剩余小时
        int minutes = totalMinutes % 60;     // 剩余分钟

        // 输出结果
        System.out.printf("相差：%d年 %d个月 %d天 %d小时 %d分钟%n",
                years, months, days, hours, minutes);

        int[] list = {days, hours, minutes}; // 相差: %d天 %d小时 %d分钟

        return list;

    }

    /**
     * 交运时间   生日加上起运时间
     */
    public static int[] obscurity3(int year, int month, int day, int hour, int minute, int minute1) {
        // 创建原始时间
        LocalDateTime start = LocalDateTime.of(year, month, day, hour, minute);
        // 加上指定分钟数
        LocalDateTime after = start.plusMinutes(minute1);
        int[] list = {after.getYear(),
                after.getMonthValue(),
                after.getDayOfMonth(),
                after.getHour(),
                after.getMinute()};

        return list;
    }

    /**
     * 旺衰      日柱天干 地支   可以推算出五行的旺衰状态
     * 传入 日干 地支
     * 返回  旺衰
     */
    public static String wangshuai(String rigan, String dizhi) {


        //甲    丙    戊    庚    壬    乙    丁    己    辛    癸
        String[][] list = {{"亥", "寅", "寅", "巳", "申", "午", "酉", "酉", "子", "卯"}, // 长生
                {"子", "卯", "卯", "午", "酉", "巳", "申", "申", "亥", "寅"},// 沐浴
                {"丑", "辰", "辰", "未", "戌", "辰", "未", "未", "戌", "丑"},// 冠带
                {"寅", "巳", "巳", "申", "亥", "卯", "午", "午", "酉", "子"},// 临官
                {"卯", "午", "午", "酉", "子", "寅", "巳", "巳", "申", "亥"},// 帝旺
                {"辰", "未", "未", "戌", "丑", "丑", "辰", "辰", "未", "戌"},// 衰
                {"巳", "申", "申", "亥", "寅", "子", "卯", "卯", "午", "酉"},// 病
                {"午", "酉", "酉", "子", "卯", "亥", "寅", "寅", "巳", "申"},// 死
                {"未", "戌", "戌", "丑", "辰", "戌", "丑", "丑", "辰", "亥"},// 墓
                {"申", "亥", "亥", "寅", "巳", "酉", "子", "子", "卯", "午"},// 绝
                {"酉", "子", "子", "卯", "午", "申", "亥", "亥", "寅", "巳"},// 胎
                {"戌", "丑", "丑", "辰", "未", "未", "戌", "戌", "丑", "辰"} // 养
        };
        String[] zhuangtai = {"长生", "沐浴", "冠带", "临官", "帝旺", "衰", "病", "死", "墓", "绝", "胎", "养"};

        int i = 0, j = 0;

        switch (rigan) {
            case "甲":
                i = 0;
                break;
            case "丙":
                i = 1;
                break;
            case "戊":
                i = 2;
                break;
            case "庚":
                i = 3;
                break;
            case "壬":
                i = 4;
                break;
            case "乙":
                i = 5;
                break;
            case "丁":
                i = 6;
                break;
            case "己":
                i = 7;
                break;
            case "辛":
                i = 8;
                break;
            case "癸":
                i = 9;
                break;
            default:
                break;
        }
        for (; j < list.length; j++) {
            if (list[j][i].equals(dizhi)) {
                break;
            }
        }

        return zhuangtai[j];
    }

    /**
     * 纳音
     * 传入 tiangan dizhi   甲  子
     */
    public static String nayin(String tiangan, String dizhi) {

        String x = tiangan + dizhi;

        return switch (x) {
            case "甲子", "乙丑" -> "海中金";
            case "丙寅", "丁卯" -> "炉中火";
            case "戊辰", "己巳" -> "大林木";
            case "庚午", "辛未" -> "路旁土";
            case "壬申", "癸酉" -> "剑锋金";
            case "甲戌", "乙亥" -> "山头火";
            case "丙子", "丁丑" -> "涧下水";
            case "戊寅", "己卯" -> "城头土";
            case "庚辰", "辛巳" -> "白蜡金";
            case "壬午", "癸未" -> "杨柳木";
            case "甲申", "乙酉" -> "泉中水";
            case "丙戌", "丁亥" -> "屋上土";
            case "戊子", "己丑" -> "霹雳火";
            case "庚寅", "辛卯" -> "松柏木";
            case "壬辰", "癸巳" -> "长流水";
            case "甲午", "乙未" -> "沙中金";
            case "丙申", "丁酉" -> "山下火";
            case "戊戌", "己亥" -> "平地木";
            case "庚子", "辛丑" -> "壁上土";
            case "壬寅", "癸卯" -> "金箔金";
            case "甲辰", "乙巳" -> "覆灯火";
            case "丙午", "丁未" -> "天河水";
            case "戊申", "己酉" -> "大驿土";
            case "庚戌", "辛亥" -> "钗钏金";
            case "壬子", "癸丑" -> "桑松木";
            case "甲寅", "乙卯" -> "大溪水";
            case "丙辰", "丁巳" -> "砂中土";
            case "戊午", "己未" -> "天上火";
            case "庚申", "辛酉" -> "石榴木";
            case "壬戌", "癸亥" -> "大海水";
            default -> throw new IllegalStateException("Unexpected value: " + x);
        };
    }

    /**
     * 神煞
     */
    public static String[][] shensha(String niangan, String nianzhi, String yuegan, String yuezhi,
                                     String rigan, String rizhi, String shigan, String shizhi) {
        String[][] shensha = new String[4][20]; // 每柱最多存20个神煞
        int yearIndex = 0;
        int monthIndex = 0;
        int dayIndex = 0;
        int hourIndex = 0;

        // 1.天乙贵人
        switch (rigan) {
            case "甲", "戊":
                if (nianzhi.equals("丑") || nianzhi.equals("未")) {
                    if (!contains(shensha[0], "天乙贵人")) {
                        shensha[0][yearIndex++] = "天乙贵人";
                    }
                }
                if (yuezhi.equals("丑") || yuezhi.equals("未")) {
                    if (!contains(shensha[1], "天乙贵人")) {
                        shensha[1][monthIndex++] = "天乙贵人";
                    }
                }
                if (rizhi.equals("丑") || rizhi.equals("未")) {
                    if (!contains(shensha[2], "天乙贵人")) {
                        shensha[2][dayIndex++] = "天乙贵人";
                    }
                }
                if (shizhi.equals("丑") || shizhi.equals("未")) {
                    if (!contains(shensha[3], "天乙贵人")) {
                        shensha[3][hourIndex++] = "天乙贵人";
                    }
                }
                break;
            case "乙", "己":
                if (nianzhi.equals("子") || nianzhi.equals("申")) {
                    if (!contains(shensha[0], "天乙贵人")) {
                        shensha[0][yearIndex++] = "天乙贵人";
                    }
                }
                if (yuezhi.equals("子") || yuezhi.equals("申")) {
                    if (!contains(shensha[1], "天乙贵人")) {
                        shensha[1][monthIndex++] = "天乙贵人";
                    }
                }
                if (rizhi.equals("子") || rizhi.equals("申")) {
                    if (!contains(shensha[2], "天乙贵人")) {
                        shensha[2][dayIndex++] = "天乙贵人";
                    }
                }
                if (shizhi.equals("子") || shizhi.equals("申")) {
                    if (!contains(shensha[3], "天乙贵人")) {
                        shensha[3][hourIndex++] = "天乙贵人";
                    }
                }
                break;
            case "丙", "丁":
                if (nianzhi.equals("亥") || nianzhi.equals("酉")) {
                    if (!contains(shensha[0], "天乙贵人")) {
                        shensha[0][yearIndex++] = "天乙贵人";
                    }
                }
                if (yuezhi.equals("亥") || yuezhi.equals("酉")) {
                    if (!contains(shensha[1], "天乙贵人")) {
                        shensha[1][monthIndex++] = "天乙贵人";
                    }
                }
                if (rizhi.equals("亥") || rizhi.equals("酉")) {
                    if (!contains(shensha[2], "天乙贵人")) {
                        shensha[2][dayIndex++] = "天乙贵人";
                    }
                }
                if (shizhi.equals("亥") || shizhi.equals("酉")) {
                    if (!contains(shensha[3], "天乙贵人")) {
                        shensha[3][hourIndex++] = "天乙贵人";
                    }
                }
                break;
            case "壬", "癸":
                if (nianzhi.equals("卯") || nianzhi.equals("巳")) {
                    if (!contains(shensha[0], "天乙贵人")) {
                        shensha[0][yearIndex++] = "天乙贵人";
                    }
                }
                if (yuezhi.equals("卯") || yuezhi.equals("巳")) {
                    if (!contains(shensha[1], "天乙贵人")) {
                        shensha[1][monthIndex++] = "天乙贵人";
                    }
                }
                if (rizhi.equals("卯") || rizhi.equals("巳")) {
                    if (!contains(shensha[2], "天乙贵人")) {
                        shensha[2][dayIndex++] = "天乙贵人";
                    }
                }
                if (shizhi.equals("卯") || shizhi.equals("巳")) {
                    if (!contains(shensha[3], "天乙贵人")) {
                        shensha[3][hourIndex++] = "天乙贵人";
                    }
                }
                break;
            case "庚", "辛":
                if (nianzhi.equals("寅") || nianzhi.equals("午")) {
                    if (!contains(shensha[0], "天乙贵人")) {
                        shensha[0][yearIndex++] = "天乙贵人";
                    }
                }
                if (yuezhi.equals("寅") || yuezhi.equals("午")) {
                    if (!contains(shensha[1], "天乙贵人")) {
                        shensha[1][monthIndex++] = "天乙贵人";
                    }
                }
                if (rizhi.equals("寅") || rizhi.equals("午")) {
                    if (!contains(shensha[2], "天乙贵人")) {
                        shensha[2][dayIndex++] = "天乙贵人";
                    }
                }
                if (shizhi.equals("寅") || shizhi.equals("午")) {
                    if (!contains(shensha[3], "天乙贵人")) {
                        shensha[3][hourIndex++] = "天乙贵人";
                    }
                }
                break;
        }

        // 2.太极贵人
        if (niangan.equals("甲") || niangan.equals("乙") || rigan.equals("甲") || rigan.equals("乙")) {
            if (nianzhi.equals("子") || nianzhi.equals("午")) {
                if (!contains(shensha[0], "太极贵人")) {
                    shensha[0][yearIndex++] = "太极贵人";
                }
            }
            if (yuezhi.equals("子") || yuezhi.equals("午")) {
                if (!contains(shensha[1], "太极贵人")) {
                    shensha[1][monthIndex++] = "太极贵人";
                }
            }
            if (rizhi.equals("子") || rizhi.equals("午")) {
                if (!contains(shensha[2], "太极贵人")) {
                    shensha[2][dayIndex++] = "太极贵人";
                }
            }
            if (shizhi.equals("子") || shizhi.equals("午")) {
                if (!contains(shensha[3], "太极贵人")) {
                    shensha[3][hourIndex++] = "太极贵人";
                }
            }
        }
        if (niangan.equals("丙") || niangan.equals("丁") || rigan.equals("丙") || rigan.equals("丁")) {
            if (nianzhi.equals("卯") || nianzhi.equals("酉")) {
                if (!contains(shensha[0], "太极贵人")) {
                    shensha[0][yearIndex++] = "太极贵人";
                }
            }
            if (yuezhi.equals("卯") || yuezhi.equals("酉")) {
                if (!contains(shensha[1], "太极贵人")) {
                    shensha[1][monthIndex++] = "太极贵人";
                }
            }
            if (rizhi.equals("卯") || rizhi.equals("酉")) {
                if (!contains(shensha[2], "太极贵人")) {
                    shensha[2][dayIndex++] = "太极贵人";
                }
            }
            if (shizhi.equals("卯") || shizhi.equals("酉")) {
                if (!contains(shensha[3], "太极贵人")) {
                    shensha[3][hourIndex++] = "太极贵人";
                }
            }
        }
        if (niangan.equals("戊") || niangan.equals("己") || rigan.equals("戊") || rigan.equals("己")) {
            if (nianzhi.equals("辰") || nianzhi.equals("戌") || nianzhi.equals("丑") || nianzhi.equals("未")) {
                if (!contains(shensha[0], "太极贵人")) {
                    shensha[0][yearIndex++] = "太极贵人";
                }
            }
            if (yuezhi.equals("辰") || yuezhi.equals("戌") || yuezhi.equals("丑") || yuezhi.equals("未")) {
                if (!contains(shensha[1], "太极贵人")) {
                    shensha[1][monthIndex++] = "太极贵人";
                }
            }
            if (rizhi.equals("辰") || rizhi.equals("戌") || rizhi.equals("丑") || rizhi.equals("未")) {
                if (!contains(shensha[2], "太极贵人")) {
                    shensha[2][dayIndex++] = "太极贵人";
                }
            }
            if (shizhi.equals("辰") || shizhi.equals("戌") || shizhi.equals("丑") || shizhi.equals("未")) {
                if (!contains(shensha[3], "太极贵人")) {
                    shensha[3][hourIndex++] = "太极贵人";
                }
            }
        }
        if (niangan.equals("庚") || niangan.equals("辛") || rigan.equals("庚") || rigan.equals("辛")) {
            if (nianzhi.equals("寅") || nianzhi.equals("亥")) {
                if (!contains(shensha[0], "太极贵人")) {
                    shensha[0][yearIndex++] = "太极贵人";
                }
            }
            if (yuezhi.equals("寅") || yuezhi.equals("亥")) {
                if (!contains(shensha[1], "太极贵人")) {
                    shensha[1][monthIndex++] = "太极贵人";
                }
            }
            if (rizhi.equals("寅") || rizhi.equals("亥")) {
                if (!contains(shensha[2], "太极贵人")) {
                    shensha[2][dayIndex++] = "太极贵人";
                }
            }
            if (shizhi.equals("寅") || shizhi.equals("亥")) {
                if (!contains(shensha[3], "太极贵人")) {
                    shensha[3][hourIndex++] = "太极贵人";
                }
            }
        }
        if (niangan.equals("壬") || niangan.equals("癸") || rigan.equals("壬") || rigan.equals("癸")) {
            if (nianzhi.equals("巳") || nianzhi.equals("申")) {
                if (!contains(shensha[0], "太极贵人")) {
                    shensha[0][yearIndex++] = "太极贵人";
                }
            }
            if (yuezhi.equals("巳") || yuezhi.equals("申")) {
                if (!contains(shensha[1], "太极贵人")) {
                    shensha[1][monthIndex++] = "太极贵人";
                }
            }
            if (rizhi.equals("巳") || rizhi.equals("申")) {
                if (!contains(shensha[2], "太极贵人")) {
                    shensha[2][dayIndex++] = "太极贵人";
                }
            }
            if (shizhi.equals("巳") || shizhi.equals("申")) {
                if (!contains(shensha[3], "太极贵人")) {
                    shensha[3][hourIndex++] = "太极贵人";
                }
            }
        }

        // 3.天德贵人
        switch (yuezhi) {
            case "寅":
                if (nianzhi.equals("丑")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("丑")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("丑")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "卯":
                if (nianzhi.equals("申")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("申")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("申")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "辰":
                if (nianzhi.equals("未")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("未")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("未")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "巳":
                if (nianzhi.equals("寅")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("寅")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("寅")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "午":
                if (nianzhi.equals("子")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("子")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("子")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "申":
                if (nianzhi.equals("辰")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("辰")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("辰")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "酉":
                if (nianzhi.equals("亥")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("亥")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("亥")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "戌":
                if (nianzhi.equals("午")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("午")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("午")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "亥":
                if (nianzhi.equals("巳")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("巳")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("巳")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "子":
                if (nianzhi.equals("戌")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("戌")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("戌")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
            case "丑":
                if (nianzhi.equals("酉")) {
                    if (!contains(shensha[0], "天德贵人")) {
                        shensha[0][yearIndex++] = "天德贵人";
                    }
                }
                if (rizhi.equals("酉")) {
                    if (!contains(shensha[2], "天德贵人")) {
                        shensha[2][dayIndex++] = "天德贵人";
                    }
                }
                if (shizhi.equals("酉")) {
                    if (!contains(shensha[3], "天德贵人")) {
                        shensha[3][hourIndex++] = "天德贵人";
                    }
                }
                break;
        }

        // 4.月德贵人
        if (yuezhi.equals("寅") || yuezhi.equals("午") || yuezhi.equals("戌")) {
            if (niangan.equals("丙") && !contains(shensha[0], "月德贵人")) {
                shensha[0][yearIndex++] = "月德贵人";
            }
            if (yuegan.equals("丙") && !contains(shensha[1], "月德贵人")) {
                shensha[1][monthIndex++] = "月德贵人";
            }
            if (rigan.equals("丙") && !contains(shensha[2], "月德贵人")) {
                shensha[2][dayIndex++] = "月德贵人";
            }
            if (shigan.equals("丙") && !contains(shensha[3], "月德贵人")) {
                shensha[3][hourIndex++] = "月德贵人";
            }
        }
        if (yuezhi.equals("申") || yuezhi.equals("子") || yuezhi.equals("辰")) {
            if (niangan.equals("壬") && !contains(shensha[0], "月德贵人")) {
                shensha[0][yearIndex++] = "月德贵人";
            }
            if (yuegan.equals("壬") && !contains(shensha[1], "月德贵人")) {
                shensha[1][monthIndex++] = "月德贵人";
            }
            if (rigan.equals("壬") && !contains(shensha[2], "月德贵人")) {
                shensha[2][dayIndex++] = "月德贵人";
            }
            if (shigan.equals("壬") && !contains(shensha[3], "月德贵人")) {
                shensha[3][hourIndex++] = "月德贵人";
            }
        }
        if (yuezhi.equals("亥") || yuezhi.equals("卯") || yuezhi.equals("未")) {
            if (niangan.equals("甲") && !contains(shensha[0], "月德贵人")) {
                shensha[0][yearIndex++] = "月德贵人";
            }
            if (yuegan.equals("甲") && !contains(shensha[1], "月德贵人")) {
                shensha[1][monthIndex++] = "月德贵人";
            }
            if (rigan.equals("甲") && !contains(shensha[2], "月德贵人")) {
                shensha[2][dayIndex++] = "月德贵人";
            }
            if (shigan.equals("甲") && !contains(shensha[3], "月德贵人")) {
                shensha[3][hourIndex++] = "月德贵人";
            }
        }
        if (yuezhi.equals("巳") || yuezhi.equals("酉") || yuezhi.equals("丑")) {
            if (niangan.equals("庚") && !contains(shensha[0], "月德贵人")) {
                shensha[0][yearIndex++] = "月德贵人";
            }
            if (yuegan.equals("庚") && !contains(shensha[1], "月德贵人")) {
                shensha[1][monthIndex++] = "月德贵人";
            }
            if (rigan.equals("庚") && !contains(shensha[2], "月德贵人")) {
                shensha[2][dayIndex++] = "月德贵人";
            }
            if (shigan.equals("庚") && !contains(shensha[3], "月德贵人")) {
                shensha[3][hourIndex++] = "月德贵人";
            }
        }

        // 5.文昌贵人
        switch (rigan) {
            case "甲":
                if (niangan.equals("己") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("己") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("己") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
            case "乙":
                if (niangan.equals("戊") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("戊") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("戊") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
            case "丙":
                if (niangan.equals("辛") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("辛") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("辛") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
            case "丁":
                if (niangan.equals("庚") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("庚") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("庚") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
            case "戊":
                if (niangan.equals("癸") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("癸") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("癸") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
            case "己":
                if (niangan.equals("壬") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("壬") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("壬") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
            case "庚":
                if (niangan.equals("乙") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("乙") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("乙") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
            case "辛":
                if (niangan.equals("甲") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("甲") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("甲") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
            case "壬":
                if (niangan.equals("丁") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("丁") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("丁") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
            case "癸":
                if (niangan.equals("丙") && !contains(shensha[0], "文昌贵人")) {
                    shensha[0][yearIndex++] = "文昌贵人";
                }
                if (yuegan.equals("丙") && !contains(shensha[1], "文昌贵人")) {
                    shensha[1][monthIndex++] = "文昌贵人";
                }
                if (shigan.equals("丙") && !contains(shensha[3], "文昌贵人")) {
                    shensha[3][hourIndex++] = "文昌贵人";
                }
                break;
        }

        // 6.魁罡
        if ((rigan.equals("庚") && rizhi.equals("辰") || rigan.equals("壬") && rizhi.equals("辰")) || (rigan.equals("戊") && rizhi.equals("戌") || rigan.equals("甲") && rizhi.equals("辰"))) {
            shensha[2][dayIndex++] = "魁罡";
        }

        // 7.将星
        if (rizhi.equals("午") || rizhi.equals("戌") || rizhi.equals("寅")) {
            if (nianzhi.equals("午")) {
                shensha[0][yearIndex++] = "将星";
            }
            if (yuezhi.equals("午")) {
                shensha[1][monthIndex++] = "将星";
            }
            if (rizhi.equals("午")) {
                shensha[2][dayIndex++] = "将星";
            }
            if (shizhi.equals("午")) {
                shensha[3][hourIndex++] = "将星";
            }
        }
        if (rizhi.equals("申") || rizhi.equals("子") || rizhi.equals("辰")) {
            if (nianzhi.equals("子")) {
                shensha[0][yearIndex++] = "将星";
            }
            if (yuezhi.equals("子")) {
                shensha[1][monthIndex++] = "将星";
            }
            if (rizhi.equals("子")) {
                shensha[2][dayIndex++] = "将星";
            }
            if (shizhi.equals("子")) {
                shensha[3][hourIndex++] = "将星";
            }
        }
        if (rizhi.equals("亥") || rizhi.equals("卯") || rizhi.equals("未")) {
            if (nianzhi.equals("卯")) {
                shensha[0][yearIndex++] = "将星";
            }
            if (yuezhi.equals("卯")) {
                shensha[1][monthIndex++] = "将星";
            }
            if (rizhi.equals("卯")) {
                shensha[2][dayIndex++] = "将星";
            }
            if (shizhi.equals("卯")) {
                shensha[3][hourIndex++] = "将星";
            }
        }
        if (rizhi.equals("巳") || rizhi.equals("酉") || rizhi.equals("丑")) {
            if (nianzhi.equals("酉")) {
                shensha[0][yearIndex++] = "将星";
            }
            if (yuezhi.equals("酉")) {
                shensha[1][monthIndex++] = "将星";
            }
            if (rizhi.equals("酉")) {
                shensha[2][dayIndex++] = "将星";
            }
            if (shizhi.equals("酉")) {
                shensha[3][hourIndex++] = "将星";
            }
        }

        // 8.华盖
        if (rizhi.equals("午") || rizhi.equals("戌") || rizhi.equals("寅")) {
            if (nianzhi.equals("戌")) {
                shensha[0][yearIndex++] = "华盖";
            }
            if (yuezhi.equals("戌")) {
                shensha[1][monthIndex++] = "华盖";
            }
            if (rizhi.equals("戌")) {
                shensha[2][dayIndex++] = "华盖";
            }
            if (shizhi.equals("戌")) {
                shensha[3][hourIndex++] = "华盖";
            }
        }
        if (rizhi.equals("申") || rizhi.equals("子") || rizhi.equals("辰")) {
            if (nianzhi.equals("辰")) {
                shensha[0][yearIndex++] = "华盖";
            }
            if (yuezhi.equals("辰")) {
                shensha[1][monthIndex++] = "华盖";
            }
            if (rizhi.equals("辰")) {
                shensha[2][dayIndex++] = "华盖";
            }
            if (shizhi.equals("辰")) {
                shensha[3][hourIndex++] = "华盖";
            }
        }
        if (rizhi.equals("亥") || rizhi.equals("卯") || rizhi.equals("未")) {
            if (nianzhi.equals("未")) {
                shensha[0][yearIndex++] = "华盖";
            }
            if (yuezhi.equals("未")) {
                shensha[1][monthIndex++] = "华盖";
            }
            if (rizhi.equals("未")) {
                shensha[2][dayIndex++] = "华盖";
            }
            if (shizhi.equals("未")) {
                shensha[3][hourIndex++] = "华盖";
            }
        }
        if (rizhi.equals("巳") || rizhi.equals("酉") || rizhi.equals("丑")) {
            if (nianzhi.equals("丑")) {
                shensha[0][yearIndex++] = "华盖";
            }
            if (yuezhi.equals("丑")) {
                shensha[1][monthIndex++] = "华盖";
            }
            if (rizhi.equals("丑")) {
                shensha[2][dayIndex++] = "华盖";
            }
            if (shizhi.equals("丑")) {
                shensha[3][hourIndex++] = "华盖";
            }
        }

        // 9.金神
        if ((rigan.equals("乙") && rizhi.equals("丑")) || (rigan.equals("己") && rizhi.equals("巳")) || (rigan.equals("癸") && rizhi.equals("酉"))) {
            shensha[2][dayIndex++] = "金神";
        }

        // 10.福星贵人
        switch (rigan) {
            case "甲":
                if (nianzhi.equals("寅")) {
                    shensha[0][yearIndex++] = "福星贵人";
                }
                if (yuezhi.equals("寅")) {
                    shensha[1][monthIndex++] = "福星贵人";
                }
                if (rizhi.equals("寅")) {
                    shensha[2][dayIndex++] = "福星贵人";
                }
                if (shizhi.equals("寅")) {
                    shensha[3][hourIndex++] = "福星贵人";
                }
                break;
            case "乙":
                if (nianzhi.equals("卯")) {
                    shensha[0][yearIndex++] = "福星贵人";
                }
                if (yuezhi.equals("卯")) {
                    shensha[1][monthIndex++] = "福星贵人";
                }
                if (rizhi.equals("卯")) {
                    shensha[2][dayIndex++] = "福星贵人";
                }
                if (shizhi.equals("卯")) {
                    shensha[3][hourIndex++] = "福星贵人";
                }
                break;
            case "丙", "丁":
                if (nianzhi.equals("酉")) {
                    shensha[0][yearIndex++] = "福星贵人";
                }
                if (yuezhi.equals("酉")) {
                    shensha[1][monthIndex++] = "福星贵人";
                }
                if (rizhi.equals("酉")) {
                    shensha[2][dayIndex++] = "福星贵人";
                }
                if (shizhi.equals("酉")) {
                    shensha[3][hourIndex++] = "福星贵人";
                }
                break;
            case "戊", "壬":
                if (nianzhi.equals("申")) {
                    shensha[0][yearIndex++] = "福星贵人";
                }
                if (yuezhi.equals("申")) {
                    shensha[1][monthIndex++] = "福星贵人";
                }
                if (rizhi.equals("申")) {
                    shensha[2][dayIndex++] = "福星贵人";
                }
                if (shizhi.equals("申")) {
                    shensha[3][hourIndex++] = "福星贵人";
                }
                break;
            case "己", "癸":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "福星贵人";
                }
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "福星贵人";
                }
                if (rizhi.equals("午")) {
                    shensha[2][dayIndex++] = "福星贵人";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "福星贵人";
                }
                break;
            case "庚":
                if (nianzhi.equals("子")) {
                    shensha[0][yearIndex++] = "福星贵人";
                }
                if (yuezhi.equals("子")) {
                    shensha[1][monthIndex++] = "福星贵人";
                }
                if (rizhi.equals("子")) {
                    shensha[2][dayIndex++] = "福星贵人";
                }
                if (shizhi.equals("子")) {
                    shensha[3][hourIndex++] = "福星贵人";
                }
                break;
            case "辛":
                if (nianzhi.equals("巳")) {
                    shensha[0][yearIndex++] = "福星贵人";
                }
                if (yuezhi.equals("巳")) {
                    shensha[1][monthIndex++] = "福星贵人";
                }
                if (rizhi.equals("巳")) {
                    shensha[2][dayIndex++] = "福星贵人";
                }
                if (shizhi.equals("巳")) {
                    shensha[3][hourIndex++] = "福星贵人";
                }
                break;

        }

        // 11.天厨贵人 21.羊刃
        switch (rigan) {
            case "甲":
                if (nianzhi.equals("辰")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("辰")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("辰")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("辰")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("卯")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("卯")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("卯")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("卯")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
                break;
            case "乙":
                if (nianzhi.equals("亥")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("亥")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("亥")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("亥")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("寅")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("寅")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("寅")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("寅")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
                break;
            case "丙":
                if (nianzhi.equals("戌")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("戌")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("戌")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("戌")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("午")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
                break;
            case "丁":
                if (nianzhi.equals("酉")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("酉")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("酉")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("酉")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("巳")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("巳")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("巳")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("巳")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
                break;
            case "戊":
                if (nianzhi.equals("申")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("申")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("申")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("申")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("午")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
                break;
            case "己":
                if (nianzhi.equals("未")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("未")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("未")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("未")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("巳")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("巳")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("巳")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("巳")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
                break;
            case "庚":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("午")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("酉")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("酉")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("酉")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("酉")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
                break;
            case "辛":
                if (nianzhi.equals("巳")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("巳")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("巳")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("巳")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("申")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("申")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("申")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("申")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
                break;
            case "壬":
                if (nianzhi.equals("辰")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("辰")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("辰")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("辰")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("子")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("子")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("子")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("子")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
            case "癸":
                if (nianzhi.equals("卯")) {
                    shensha[0][yearIndex++] = "天厨贵人";
                }
                if (yuezhi.equals("卯")) {
                    shensha[1][monthIndex++] = "天厨贵人";
                }
                if (rizhi.equals("卯")) {
                    shensha[2][dayIndex++] = "天厨贵人";
                }
                if (shizhi.equals("卯")) {
                    shensha[3][hourIndex++] = "天厨贵人";
                }
                if (nianzhi.equals("亥")) {
                    shensha[0][yearIndex++] = "羊刃";
                }
                if (yuezhi.equals("亥")) {
                    shensha[1][monthIndex++] = "羊刃";
                }
                if (rizhi.equals("亥")) {
                    shensha[2][dayIndex++] = "羊刃";
                }
                if (shizhi.equals("亥")) {
                    shensha[3][hourIndex++] = "羊刃";
                }
                break;
        }

        // 12.桃花  18.劫煞 19.灾煞 20.亡神
        switch (rizhi) {
            case "寅", "午", "戌":
                if (nianzhi.equals("卯")) {
                    shensha[0][yearIndex++] = "桃花";
                }
                if (yuezhi.equals("卯")) {
                    shensha[1][monthIndex++] = "桃花";
                }
                if (shizhi.equals("卯")) {
                    shensha[3][hourIndex++] = "桃花";
                }
                if (nianzhi.equals("丑")) {
                    shensha[0][yearIndex++] = "劫煞";
                }
                if (yuezhi.equals("丑")) {
                    shensha[1][monthIndex++] = "劫煞";
                }
                if (shizhi.equals("丑")) {
                    shensha[3][hourIndex++] = "劫煞";
                }
                if (nianzhi.equals("子")) {
                    shensha[0][yearIndex++] = "灾煞";
                }
                if (yuezhi.equals("子")) {
                    shensha[1][monthIndex++] = "灾煞";
                }
                if (shizhi.equals("子")) {
                    shensha[3][hourIndex++] = "灾煞";
                }
                if (nianzhi.equals("巳")) {
                    shensha[0][yearIndex++] = "亡神";
                }
                if (yuezhi.equals("巳")) {
                    shensha[1][monthIndex++] = "亡神";
                }
                if (shizhi.equals("巳")) {
                    shensha[3][hourIndex++] = "亡神";
                }
                break;
            case "申", "子", "辰":
                if (nianzhi.equals("酉")) {
                    shensha[0][yearIndex++] = "桃花";
                }
                if (yuezhi.equals("酉")) {
                    shensha[1][monthIndex++] = "桃花";
                }
                if (shizhi.equals("酉")) {
                    shensha[3][hourIndex++] = "桃花";
                }
                if (nianzhi.equals("未")) {
                    shensha[0][yearIndex++] = "劫煞";
                }
                if (yuezhi.equals("未")) {
                    shensha[1][monthIndex++] = "劫煞";
                }
                if (shizhi.equals("未")) {
                    shensha[3][hourIndex++] = "劫煞";
                }
                if (nianzhi.equals("酉")) {
                    shensha[0][yearIndex++] = "灾煞";
                }
                if (yuezhi.equals("酉")) {
                    shensha[1][monthIndex++] = "灾煞";
                }
                if (shizhi.equals("酉")) {
                    shensha[3][hourIndex++] = "灾煞";
                }
                if (nianzhi.equals("亥")) {
                    shensha[0][yearIndex++] = "亡神";
                }
                if (yuezhi.equals("亥")) {
                    shensha[1][monthIndex++] = "亡神";
                }
                if (shizhi.equals("亥")) {
                    shensha[3][hourIndex++] = "亡神";
                }
                break;
            case "巳", "酉", "丑":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "桃花";
                }
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "桃花";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "桃花";
                }
                if (nianzhi.equals("辰")) {
                    shensha[0][yearIndex++] = "劫煞";
                }
                if (yuezhi.equals("辰")) {
                    shensha[1][monthIndex++] = "劫煞";
                }
                if (shizhi.equals("辰")) {
                    shensha[3][hourIndex++] = "劫煞";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "灾煞";
                }
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "灾煞";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "灾煞";
                }
                if (nianzhi.equals("申")) {
                    shensha[0][yearIndex++] = "亡神";
                }
                if (yuezhi.equals("申")) {
                    shensha[1][monthIndex++] = "亡神";
                }
                if (shizhi.equals("申")) {
                    shensha[3][hourIndex++] = "亡神";
                }
                break;
            case "亥", "卯", "未":
                if (nianzhi.equals("子")) {
                    shensha[0][yearIndex++] = "桃花";
                }
                if (yuezhi.equals("子")) {
                    shensha[1][monthIndex++] = "桃花";
                }
                if (shizhi.equals("子")) {
                    shensha[3][hourIndex++] = "桃花";
                }
                if (nianzhi.equals("戌")) {
                    shensha[0][yearIndex++] = "劫煞";
                }
                if (yuezhi.equals("戌")) {
                    shensha[1][monthIndex++] = "劫煞";
                }
                if (shizhi.equals("戌")) {
                    shensha[3][hourIndex++] = "劫煞";
                }
                if (nianzhi.equals("卯")) {
                    shensha[0][yearIndex++] = "灾煞";
                }
                if (yuezhi.equals("卯")) {
                    shensha[1][monthIndex++] = "灾煞";
                }
                if (shizhi.equals("卯")) {
                    shensha[3][hourIndex++] = "灾煞";
                }
                if (nianzhi.equals("寅")) {
                    shensha[0][yearIndex++] = "亡神";
                }
                if (yuezhi.equals("寅")) {
                    shensha[1][monthIndex++] = "亡神";
                }
                if (shizhi.equals("寅")) {
                    shensha[3][hourIndex++] = "亡神";
                }
                break;
        }

        // 13.红鸾
        switch (rizhi) {
            case "子":
                if (nianzhi.equals("卯")) {
                    shensha[0][yearIndex++] = "红鸾";
                }
                if (yuezhi.equals("卯")) {
                    shensha[1][monthIndex++] = "红鸾";
                }
                if (shizhi.equals("卯")) {
                    shensha[3][hourIndex++] = "红鸾";
                }
                break;
            case "午":
                if (nianzhi.equals("酉")) {
                    shensha[0][yearIndex++] = "红鸾";
                }
                if (yuezhi.equals("酉")) {
                    shensha[1][monthIndex++] = "红鸾";
                }
                if (shizhi.equals("酉")) {
                    shensha[3][hourIndex++] = "红鸾";
                }
                break;
            case "卯":
                if (nianzhi.equals("子")) {
                    shensha[0][yearIndex++] = "红鸾";
                }
                if (yuezhi.equals("子")) {
                    shensha[1][monthIndex++] = "红鸾";
                }
                if (shizhi.equals("子")) {
                    shensha[3][hourIndex++] = "红鸾";
                }
                break;
            case "酉":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "红鸾";
                }
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "红鸾";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "红鸾";
                }
                break;
            case "寅", "申":
                if (nianzhi.equals("丑")) {
                    shensha[0][yearIndex++] = "红鸾";
                }
                if (yuezhi.equals("丑")) {
                    shensha[1][monthIndex++] = "红鸾";
                }
                if (shizhi.equals("丑")) {
                    shensha[3][hourIndex++] = "红鸾";
                }
                break;
            case "巳", "亥":
                if (nianzhi.equals("寅")) {
                    shensha[0][yearIndex++] = "红鸾";
                }
                if (yuezhi.equals("寅")) {
                    shensha[1][monthIndex++] = "红鸾";
                }
                if (shizhi.equals("寅")) {
                    shensha[3][hourIndex++] = "红鸾";
                }
                break;
            case "辰", "戌":
                if (nianzhi.equals("巳")) {
                    shensha[0][yearIndex++] = "红鸾";
                }
                if (yuezhi.equals("巳")) {
                    shensha[1][monthIndex++] = "红鸾";
                }
                if (shizhi.equals("巳")) {
                    shensha[3][hourIndex++] = "红鸾";
                }
                break;
            case "丑", "未":
                if (nianzhi.equals("辰")) {
                    shensha[0][yearIndex++] = "红鸾";
                }
                if (yuezhi.equals("辰")) {
                    shensha[1][monthIndex++] = "红鸾";
                }
                if (shizhi.equals("辰")) {
                    shensha[3][hourIndex++] = "红鸾";
                }
                break;

        }

        // 14.天喜
        // 获取出生季节
        String jijie = null;
        switch (yuezhi) {
            case "寅", "卯", "辰" -> jijie = "春";
            case "巳", "午", "未" -> jijie = "夏";
            case "申", "酉", "戌" -> jijie = "秋";
            case "亥", "子", "丑" -> jijie = "冬";
        }
        switch (jijie) {
            case "春" -> {
                if (nianzhi.equals("戌")) {
                    shensha[0][yearIndex++] = "天喜";
                }
                if (yuezhi.equals("戌")) {
                    shensha[1][monthIndex++] = "天喜";
                }
                if (shizhi.equals("戌")) {
                    shensha[3][hourIndex++] = "天喜";
                }
            }
            case "夏" -> {
                if (nianzhi.equals("丑")) {
                    shensha[0][yearIndex++] = "天喜";
                }
                if (yuezhi.equals("丑")) {
                    shensha[1][monthIndex++] = "天喜";
                }
                if (shizhi.equals("丑")) {
                    shensha[3][hourIndex++] = "天喜";
                }
            }
            case "秋" -> {
                if (nianzhi.equals("辰")) {
                    shensha[0][yearIndex++] = "天喜";
                }
                if (yuezhi.equals("辰")) {
                    shensha[1][monthIndex++] = "天喜";
                }
                if (shizhi.equals("辰")) {
                    shensha[3][hourIndex++] = "天喜";
                }
            }
            case "冬" -> {
                if (nianzhi.equals("未")) {
                    shensha[0][yearIndex++] = "天喜";
                }
                if (yuezhi.equals("未")) {
                    shensha[1][monthIndex++] = "天喜";
                }
                if (shizhi.equals("未")) {
                    shensha[3][hourIndex++] = "天喜";
                }
            }

        }

        // 15.孤鸾煞
        if ((rigan.equals("甲") && rizhi.equals("寅")) || (rigan.equals("乙") && rizhi.equals("卯")) || (rigan.equals("庚") && rizhi.equals("申"))
                || (rigan.equals("辛") && rizhi.equals("酉"))) {
            shensha[2][dayIndex++] = "孤鸾煞";
        }
        // 16.阴阳差错
        if ((rigan.equals("丙") && rizhi.equals("子")) || (rigan.equals("丁") && rizhi.equals("丑")) || (rigan.equals("戊") && rizhi.equals("寅"))
                || (rigan.equals("辛") && rizhi.equals("卯")) || (rigan.equals("壬") && rizhi.equals("辰")) || (rigan.equals("癸") && rizhi.equals("巳"))
                || (rigan.equals("丁") && rizhi.equals("未")) || (rigan.equals("戌") && rizhi.equals("申")) || (rigan.equals("己") && rizhi.equals("酉"))
                || (rigan.equals("甲") && rizhi.equals("戌")) || (rigan.equals("乙") && rizhi.equals("亥"))) {
            shensha[3][hourIndex++] = "阴阳差错";
        }

        // 17.六冲
        switch (nianzhi) {
            case "子":
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("午")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "丑":
                if (yuezhi.equals("未")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("未")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("未")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "寅":
                if (yuezhi.equals("申")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("申")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("申")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "卯":
                if (yuezhi.equals("酉")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("酉")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("酉")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "辰":
                if (yuezhi.equals("戌")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("戌")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("戌")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "巳":
                if (yuezhi.equals("亥")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("亥")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("亥")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
        }
        switch (yuezhi) {
            case "子":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (rizhi.equals("午")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "丑":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (rizhi.equals("未")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("未")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "寅":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (rizhi.equals("申")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("申")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "卯":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (rizhi.equals("酉")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("酉")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "辰":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (rizhi.equals("戌")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("戌")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "巳":
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (rizhi.equals("亥")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (shizhi.equals("亥")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
        }
        switch (rizhi) {
            case "子":
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (shizhi.equals("午")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "丑":
                if (yuezhi.equals("未")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (shizhi.equals("未")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "寅":
                if (yuezhi.equals("申")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (shizhi.equals("申")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "卯":
                if (yuezhi.equals("酉")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (shizhi.equals("酉")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "辰":
                if (yuezhi.equals("戌")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (shizhi.equals("戌")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
            case "巳":
                if (yuezhi.equals("亥")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                if (shizhi.equals("亥")) {
                    shensha[3][hourIndex++] = "六冲";
                }
                break;
        }
        switch (shizhi) {
            case "子":
                if (yuezhi.equals("午")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("午")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                break;
            case "丑":
                if (yuezhi.equals("未")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("未")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                break;
            case "寅":
                if (yuezhi.equals("申")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("申")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                break;
            case "卯":
                if (yuezhi.equals("酉")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("酉")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                break;
            case "辰":
                if (yuezhi.equals("戌")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("戌")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                break;
            case "巳":
                if (yuezhi.equals("亥")) {
                    shensha[1][monthIndex++] = "六冲";
                }
                if (rizhi.equals("亥")) {
                    shensha[2][dayIndex++] = "六冲";
                }
                if (nianzhi.equals("午")) {
                    shensha[0][yearIndex++] = "六冲";
                }
                break;
        }


        return shensha;
    }

    public static String[][] tt(String niangan, String nianzhi, String yuegan, String yuezhi,
                                String rigan, String rizhi, String shigan, String shizhi) {
        String[][] shensha = new String[4][20]; // 每柱最多存20个神煞
        int yearIndex = 0;
        int monthIndex = 0;
        int dayIndex = 0;
        int hourIndex = 0;


        // 22.空亡
        // 确定所在旬
        String temp = niangan + nianzhi;
        String xun = null;
        for (int i = 0; i < 6; i++) {
            for (int j = 0; j < 10; j++) {
                if(JIAZI[i][j].equals(temp)) {
                    xun = JIAZI[i][0];
                }
            }
        }


        return shensha;
    }

    public static String jijie(String niangan, String nianzhi, String yuegan, String yuezhi, String rigan, String rizhi, String shigan, String shizhi) {

        switch (yuezhi) {
            case "寅":
            case "卯":
            case "辰":
                return "春";
            case "巳":
            case "午":
            case "未":
                return "夏";
            case "申":
            case "酉":
            case "戌":
                return "秋";
            case "亥":
            case "子":
            case "丑":
                return "冬";
            default:
                throw new IllegalArgumentException("无效的地支：" + yuezhi);
        }
    }

    // 检查数组中是否已包含某神煞
    private static boolean contains(String[] array, String value) {
        for (String s : array) {
            if (value.equals(s)) {
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        System.setProperty("file.encoding", "UTF-8");
//        String bian = getEightCharacters(2023, 1, 11, 20, 44);
//        System.out.println(bian);

//        String wangshuai = wangshuai("壬", "巳");
//        System.out.println(wangshuai);

//        String nayin = nayin("壬", "午");
//        System.out.println(nayin);

        String[][] shensha = shensha("乙", "巳", "癸", "未", "己", "卯", "壬", "申");
        System.out.println();
    }
}
